package collectionexercise02;

import java.util.ArrayList;
import java.util.List;

public class ListDemo2 {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
        list.add("one");
        list.add("two");
        list.add("three");
        list.add("four");
        list.add("five");
        System.out.println(list);
       String s1= list.get(2);
        System.out.println("s1:"+s1);//s1:three
        list.set(2,"six");
        System.out.println(list);//[one, two, six, four, five]
       String s2= list.remove(2);
        System.out.println("list"+list);//[one, two, four, five]
        System.out.println("s2:"+s2);//six
        list.remove("two");
        System.out.println(list);//[one,  four, five]
        list.add(2,"two");
        System.out.println(list);//[one,  four, five,two]





    }
}
